import { Injectable } from '@nestjs/common';

type AgentType = 'API'|'BASIC'|'USER_INSTENT'

@Injectable()
export class AgentService {
    type: AgentType='USER_INSTENT'
    modelMap:Map<AgentType,string>=new Map()
    model:string=this.modelMap.get(this.type) || ''

    constructor() {
    }

    useAgentModel(type: AgentType) {
        return this.getCurrentAgentModel(type)
    }

    changeAgentType(agentType: AgentType,model?:string) {
        this.type = agentType
        if (model) {
            this.modelMap.set(agentType,model)
        }
        this.model = this.getCurrentAgentModel(agentType) || ''
    }

    setAgentType(agentType: AgentType,model:string) {
        this.modelMap.set(agentType,model)

        const cachedModel = this.getCurrentAgentModel(agentType)

        return cachedModel
    }

    getCurrentAgentModel(type: AgentType) {
        return this.modelMap.get(type)
    }   
}
